package com.bigdata.movieticketapi.controller;

import com.bigdata.movieticketapi.common.pojo.PageResult;
import com.bigdata.movieticketapi.service.ICancelOrderService;
import com.bigdata.movieticketapi.vo.req.AuditReqVO;
import com.bigdata.movieticketapi.vo.req.CancelOrderReqVO;
import com.bigdata.movieticketapi.vo.req.CinemaTypeReqVO;
import com.bigdata.movieticketapi.vo.req.PageCancelOrderReqVO;
import com.bigdata.movieticketapi.vo.resp.PageCancelOrderRespVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * <p>
 * 记录取消订单 前端控制器
 * </p>
 *
 * @author movie
 * @since 2023-11-15
 */
@RestController
@RequestMapping("/api")
@Api(tags = "取消订单模块")
@EnableTransactionManagement
public class CancelOrderController {

    @Resource
    private ICancelOrderService iCancelOrderService;

    @PostMapping("/admin/cancelOrder/apply")
    @ApiOperation(value = "申请退款接口")
    public void applyCancelOrder(@RequestBody @Valid CancelOrderReqVO vo){
        iCancelOrderService.cancelOrder(vo);
    }

    @PostMapping("/admin/cancelOrder/audit")
    @ApiOperation(value = "审核接口")
    public void audit(@RequestBody @Valid AuditReqVO vo){
        iCancelOrderService.audit(vo);
    }

    @PostMapping("/admin/cancelOrder")
    @ApiOperation(value = "分页接口")
    public PageResult<PageCancelOrderRespVO> pageCancelOrder(@RequestBody @Valid PageCancelOrderReqVO vo){
        return iCancelOrderService.pageCancelOrder(vo);
    }
}
